package com.maikang.exammall.entity;


public class UserContext {
    private static final ThreadLocal<User> ctx = new ThreadLocal<>();


    public static void setUser(User user){
        ctx.set(user);
    }

    public static void remove(){
        ctx.remove();
    }

    public static User getUser(){
        return ctx.get();
    }

    public static Long getUserId(){
        return ctx.get().getId();
    }
}
